import { Action, createReducer, on } from "@ngrx/store";
import { updateGraphConfigAction } from "../action/graph-config.action";

const initialState: any = {
  container: null,
  grid: true,
  selecting: true,
  panning: true,
};

const _graphConfigReducer = createReducer(
  initialState,
  on(updateGraphConfigAction, (state, config) => {
    return { ...state, ...config };
  })
);

export function graphConfigReducer(state: any | undefined, action: Action) {
  return _graphConfigReducer(state, action);
}
